<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>用户登录</title>
  <link type="text/css" rel="stylesheet" href="../css/MyCss.css" />
  <link type="text/css" rel="stylesheet" href="../css/login.css" />
  <link type="text/css" rel="stylesheet" href="../css/base.css" />
  <style>
	*{margin:0;padding:0;}
	

  </style>
 </head>
 <body>
	<!--S - infor-nav-->
	<div class="infor-nav">
		<div class="infor-nav-con">
			<!--登录 注册 我的订单 我的个人信息 购物车 -->
			<ul>
				<li>
					<label class="loginText">您正在登录</label>&nbsp;&nbsp;&nbsp;&nbsp;
					<label class="register-bt">注册</label>
				</li>
				<li></li>
				<li></li>
				<li>
					<label class="my-infor">我的个人信息</label>&nbsp;&nbsp;
					<label class="my-order">我的订单</label>&nbsp;&nbsp;
					<label class="my-cart">
						<!--
						<i class="my-cart-i" title="购物车"></i>
						-->
						购物车
					</label>
				</li>
			</ul>
		</div>
	</div>
	<!--E - infor-nav-->

	<!--S - follow-box-->
	<div class="follow-box"></div>
	<!--E - follow-box-->

	<!--S - goods-nav-->
	<div class="goods-nav">
		<div class="goods-nav-con">
			<div class="shop-icon">
				<a href="../index.html"></a>
			</div>
			<div class="shop-nav">
				<ul>
					<li>服装</li>
					<li>日用品</li>
					<li>食品</li>
					<li>电子产品</li>
					<li>高科技</li>
				</ul>
			</div>
			<!--查找-->
			<div class="search" id="search">
				<input type="text" placeholder="请输入要商品关键字" id="search_text">
				<input type="button" value="搜索本站" id="search_button">
				<!--搜索结果显示区-->
				<div class="search_show" id="search_show"></div>
			</div>
			</div>
		</div>
	</div>
	<!--E - goods-nav-->

	<!-- start body -->
	<div class="body">
		<div class="body_box">
			<!-- start 其他模块 -->
			<div class="others"></div>
			<!-- end 其他模块 -->

			<!-- start login_box 登录模块 -->
			<div class="login_box">
				<div class="login_box_login">
					
					<div class="login" id="login">
						<!-- start login_head -->
						<div class="login_head">
							<div class="wellcome_register">
								<a class="Lo_a1">欢迎登录</a>
							</div>
							<div class="wellcome_longin">
								<a class="Lo_a2">未注册可前往<em class="Lo_em">注册</em></a>
							</div>
						</div>
						<!-- end login_head -->

						<!-- start login_form -->
						<div class="login_form">
							<div class="formcontainer">
								<form class="form-of-login" action="member_login" method="post">
									<!-- 用户名输入框 -->
									<div class="userctn">
										<div class="userico"><i class="user_ico"></i></div>
										<div class="usertext">
											<input type="text" required class="user" name="user" onfocus="onfucus_('userctn')" onblur="InvalidUserName()" placeholder="请输入用户名">
											
										</div>
									</div>
									<!-- 密码输入框 -->
									<div class="passctn">
										<div class="passico"><i class="pass_ico"></i></div>
										<div class="passtext">
											<input type="password" required class="password" name="password" onfocus="onfucus_('passctn')" onblur="InvalidPassword()" placeholder="请输入密码">
										</div>
									</div>
									<!-- 验证码 -->
									<div class="vercodectn">
										<div class="vetico"><i class="ver_ico"></i></div>
										<div class="vertext">
											<input type="text" required class="vercode" name="vercode" onfocus="onfucus_('vercodectn')" onmouseout="InvalidVercode()" placeholder="请输入验证码">
										</div>
										<div class="verpi"><image title="点击切换验证码" style="cursor: pointer;" class="verimg" src="../image/login/jpg.jpg" height="39px" width="89px"></div>
									</div>
									<!-- 自动登录选项 -->
									<div class="autoctn">
										<span>自动登录</span>&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="loginauto" value="auto" >
									</div>
									<!-- 按钮 -->
									<div class="submitctn">
										<div style="width:65%;">
											<input type="submit" class="submit_" value="登  录" >
										</div>
										<div style="width:35%;">
											<input type="reset" value="清空" >
										</div>
									</div>
								</form>
							</div>
						</div>
						<!-- end login_form -->
					</div>
				</div>

			</div>
			<!-- end login_box -->
		</div>
	</div>
	<!-- body end -->

	<!-- start bom -->
	<div class="bom">
		<div class="bom_container">
			<li style="color:#586069;list-style:none;padding:10px 245px;">Copyright ©2017 <span  style="color:#a71d5d;cursor:pointer;" title="作者介绍">chen</span> Powered By <span  style="color:#a71d5d;cursor:pointer;" title="程序目录">Login</span> Version 1.0.0</li>
		</div>
	</div>
	<!-- bom end -->
	<script src="../js/MyjsV0-8.js"></script>
	<script src="../js/util-2.js"></script>
	<script>
		$$.formAjax({
			formEle:$(".form-of-login")[0],
			success:function(msg){
				linkTo.loca("../index.html") ;
			},error:function(msg){
				console.log(unicodeUtil.parseC(msg)) ;
			}
		}) ;
		var VERCODE = "" ;
		
		//获取焦点时设置相应的边框颜色
		function onfucus_(ClassName){
			$("."+ClassName)[0].style.borderColor="deepskyblue" ;
		}
		//失去焦点时设置相应的边框颜色
		function onblur_(ClassName){
			$("."+ClassName)[0].style.borderColor="#ccc" ;
		}

		//有效的用户
		function InvalidUserName(){
			var INFOVAL=$("."+"user")[0].value ;
			var FLAG_REG = false ;
			var reg = new RegExp("^[a-zA-Z0-9]{5,16}$");
			if(reg.test(INFOVAL)){
				//合法
				onblur_('userctn') ;
				FLAG_REG = true ;
				$("."+"userctn")[0].title = "用户名填写正确" ;
			}else{
				$("."+"userctn")[0].style.borderColor="red" ;
				$("."+"userctn")[0].title = "请填写6-16位有效用户名" ;
			}
			return FLAG_REG ;
		}
		//有效的密码
		function InvalidPassword(){
			var INFOVAL = $("."+"user")[0].value ;
			var FLAG_REG = false ;
			var reg = new RegExp("^[a-zA-Z0-9]{5,16}$");
			if(reg.test(INFOVAL)){
				//合法
				onblur_('passctn') ;
				FLAG_REG = true ;
				$("."+"passctn")[0].title = "密码填写正确" ;
			}else{
				$("."+"passctn")[0].style.borderColor="red" ;
				$("."+"passctn")[0].title = "请填写6-16位有效密码" ;
			}
			return FLAG_REG ;
		}
		//验证码框验证
		function InvalidVercode(){
			var INFOVAL = $("."+"vercode")[0].value ; 
			var FLAG_REG = false ;
			//验证码字数不足或者为空
			if(INFOVAL.length != 4){
				$("."+"vercodectn")[0].style.borderColor = "red" ;
				$("."+"vercodectn")[0].title = "请填写正确的验证码" ;
			}
			//验证码无字数异常
			else if(INFOVAL.length == 4){
				if(INFOVAL==VERCODE){
					FLAG_REG = true ;
					$("."+"vercodectn")[0].title = "验证码填写正确" ;
					onblur_('vercodectn');
				}
				else{
					$("."+"vercodectn")[0].style.borderColor = "red" ;
					$("."+"vercodectn")[0].title = "请填写正确的验证码" ;
				}
			}
			return FLAG_REG ;
		}
		//获取验证码
		getVerPi();
		function getVerPi(){
			ajax({
				type:"post",
				url:"../merchantVer",
				success:function(msg){
					var a=msg.split("-*-") ;
					//设置src base64
					setSrc(a[0]) ;
					//设置验证码的值
					setCode(a[1]) ;
				}
			})
		}
		//获取后天验证码
		function setCode(code){
			VERCODE = code ;
		}
		//设置验证码图base64
		function setSrc(img){
			$("."+"verimg")[0].src = img;
		}
		$("."+"verimg")[0].onclick=function(){
			getVerPi();
		}
		//获取登录状态
		//getLoginState();
		function getLoginState(){
			ajax({
				type:"post",
				url:"GetLoginState",
				success:function(msg){
					if(msg.indexOf("param1")!=-1){
						console.log("用户名密码不能为空");
					}else if(msg.indexOf("param3")!=-1){
						console.log("当前用户名未注册请前往注册");
					}else if(msg.indexOf("param4")!=-1){
						console.log("该账号已在别地登录") ;
					}else{
						console.log("无登录信息") ;
					}
				}
			})
		}

		$(".register-bt")[0].onclick = function(){
			window.open('memberRegister.html');
		}
		$(".loginText")[0].onclick = function(){
			window.open('memberLogin.html');
		}
		$(".Lo_em")[0].onclick = function(){
			window.open('memberRegister.html');
		}
	</script>
 </body>
</html>